package com.yunhai.device.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yunhai.common.dto.PaginationVo;
import com.yunhai.common.dto.Ret;
import com.yunhai.device.service.OrrOutcupHourlyDispensingService;
import com.yunhai.model.entity.orr.OrrOutcupHourlyDispensingEntity;
import com.yunhai.model.vo.orr.OrrOutcupHourlyDispensingQuery;
import com.yunhai.model.vo.orr.OrrOutcupHourlyDispensingVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/orrOutcupHourlyDispensing")
public class OrrOutcupHourlyDispensingController {

	@Resource
	private OrrOutcupHourlyDispensingService orrOutcupHourlyDispensingService;


	/**
	 * 获取 OrrOutcupHourlyDispensing 分页列表
	 */
	@GetMapping("/pagination")
	public Ret getOrrOutcupHourlyDispensingPagination(PaginationVo paginationVo, OrrOutcupHourlyDispensingQuery orrOutcupHourlyDispensingQuery ) throws Exception {
		IPage page = orrOutcupHourlyDispensingService.getOrrOutcupHourlyDispensingPagination(paginationVo, orrOutcupHourlyDispensingQuery );
		return Ret.toPage(page);
	}


	/**
	 * 获取 OrrOutcupHourlyDispensing 所有数据
	 */
	@GetMapping("/allList")
	public Ret getOrrOutcupHourlyDispensingAllList( OrrOutcupHourlyDispensingQuery orrOutcupHourlyDispensingQuery ) throws Exception {
		List<OrrOutcupHourlyDispensingEntity> list = orrOutcupHourlyDispensingService.getOrrOutcupHourlyDispensingAllList( orrOutcupHourlyDispensingQuery );
		return Ret.ok(list);
	}


	/**
	 * 获取 OrrOutcupHourlyDispensing 详情
	 */
	@GetMapping("/{id}")
	public Ret getOrrOutcupHourlyDispensingDetailById(@PathVariable Long id) throws Exception {

	    OrrOutcupHourlyDispensingEntity orrOutcupHourlyDispensingEntity = orrOutcupHourlyDispensingService.getOrrOutcupHourlyDispensingDetail(id);
		return Ret.ok(orrOutcupHourlyDispensingEntity);
	}


	/**
	 * 新增 OrrOutcupHourlyDispensing
	 * */
	@PostMapping("")
	public Ret addOrrOutcupHourlyDispensing(@RequestBody OrrOutcupHourlyDispensingVo orrOutcupHourlyDispensingVo) throws Exception {

		orrOutcupHourlyDispensingService.addOrrOutcupHourlyDispensing(orrOutcupHourlyDispensingVo);
		return Ret.ok();
	}


	/**
	 * 更新 OrrOutcupHourlyDispensing
	 * */
	@PutMapping("")
	public Ret updateOrrOutcupHourlyDispensing(@RequestBody OrrOutcupHourlyDispensingVo orrOutcupHourlyDispensingVo) throws Exception {

		orrOutcupHourlyDispensingService.updateOrrOutcupHourlyDispensing(orrOutcupHourlyDispensingVo);
		return Ret.ok();
	}


	/**
	 * 删除 OrrOutcupHourlyDispensing
	 * */
	@PostMapping("/batchRemove")
	public Ret batchRemoveOrrOutcupHourlyDispensing( @RequestBody List<Long> ids ) throws Exception {

	    orrOutcupHourlyDispensingService.batchRemoveOrrOutcupHourlyDispensing(ids);
		return Ret.ok();
	}
}
